package com.atguigu.tingshu.account.api;

import com.atguigu.tingshu.account.service.UserAccountService;
import com.atguigu.tingshu.common.login.GuiGuLogin;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.common.util.AuthContextHolder;
import com.atguigu.tingshu.model.user.VipServiceConfig;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

@Slf4j
@Tag(name = "用户账户管理")
@RestController
@RequestMapping("api/account")
@SuppressWarnings({"all"})
public class UserAccountApiController {

	@Autowired
	private UserAccountService userAccountService;



	/**
	 * 获取账户可用余额
	 * /api/account/userAccount/getAvailableAmount
	 * @return
	 */
	@GetMapping("/userAccount/getAvailableAmount")
	@GuiGuLogin
	public Result<BigDecimal> getAvailableAmount() {
		Long userId = AuthContextHolder.getUserId();
		log.info("用户id：{}", userId);
		return userAccountService.getAvailableAmount(userId);
	}



}

